<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #divArea{
            height: 200px;
            background-color: gray;
        }
    </style>
</head>
<body>
    <textarea id="area"></textarea>
    <button>添加</button><button>删除</button>

    <div id="divArea"></div>
    <button>添加</button><button>删除</button>
    <script>
        let btnArr = document.getElementsByTagName("button");
        let area = document.getElementById("area");
        let divArea = document.getElementById("divArea");
        btnArr[0].addEventListener('click',(e)=>{
            area.value += 123;
        });
        btnArr[1].addEventListener('click',(e)=>{
            area.value = '';
        });
        btnArr[2].addEventListener('click',()=>{
            // divArea.innerHTML += "123";
            divArea.innerText +="123";
        });
        btnArr[3].addEventListener('click',()=>{
            divArea.innerHTML = "";
        });
    </script>
</body>
</html>